<%@ page language="java" %>

<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/webflow.tld" prefix="webflow" %>
<%@ taglib uri="/WEB-INF/webform.tld" prefix="webform" %>

<%@ page import="com.broadvision.bpmapp.docreview.Document" %>
<%@ page import="com.broadvision.cm.service.util.NameUtil" %>
<%@ page import="org.apache.commons.beanutils.PropertyUtils" %>
<%@ page import="org.apache.commons.beanutils.PropertyUtils" %>
	
<script language="JavaScript">
function openwin(file) {
  var win = window.open(file, "NewWindow", 'toolbar=no,location=no,directories=no,status=no,menubar=yes,scrollbars=yes,resizable=yes,copyhistory=yes,width=450,height=338');
  win.focus();
}
</script>

<div class="app_pageSubtitle">
  <span class="left"><bean:message bundle="appCommonRes" key="dr.process"/></span>
  <span class="right">&nbsp;</span>
</div>

<div class="blockWrap">
<table class="labelForm" width="100%" border="0" cellspacing="0" cellpadding="0" summary="<bean:message bundle="appCommonRes" key="dr.processInfo"/>">
<tr> 
  <td class="label" width="10%"><bean:message bundle="appCommonRes" key="dr.name"/>:</td>
  <td class="labelField" width="90%"><bean:write name="uploadView" property="procName" /></td>
</tr>

<tr> 
  <td class="label" width="10%"><bean:message bundle="appCommonRes" key="dr.description"/>:</td>
  <td class="labelField" width="90%"><bean:write name="uploadView" property="procDescription" /></td>
</tr>			  

<tr> 
  <td class="label" width="10%"><bean:message bundle="appCommonRes" key="dr.type"/>:</td>
  <td class="labelField" width="90%"><bean:write name="uploadView" property="type" /></td>
</tr>

<tr> 
  <td class="label" width="10%"><bean:message bundle="appCommonRes" key="dr.subtype"/>:</td>
  <td class="labelField" width="90%"><bean:write name="uploadView" property="subtype" /></td>
</tr>
</table>
</div>

<div class="app_pageSubtitle">
  <span class="left"><bean:message bundle="appCommonRes" key="dr.document"/></span>
  <span class="right">&nbsp;</span>
</div>

<div class="blockWrap">
<form>
<table class="dataTable" border="0" cellspacing="1" cellpadding="2" width="100%" summary="<bean:message bundle="appCommonRes" key="dr.documentInfo"/>">
<tr class="listHeader"> 
  <th id="Name" align="left"><bean:message bundle="appCommonRes" key="dr.name"/></th>
  <th id="Description" align="left"><bean:message bundle="appCommonRes" key="dr.description"/></th>
  <th id="Filename" align="left" nowrap><bean:message bundle="appCommonRes" key="dr.filename"/></th>
  <th id="Actions" align="left" nowrap><bean:message bundle="appCommonRes" key="dr.actions"/></th>
</tr>     
<logic:iterate id="doc" name="uploadView" property="documentList" indexId="index">
<tr class='<%=index.intValue() %2 == 0 ? "listEven" : "listOdd"%>'>
  <td headers="Name"><bean:write name="doc" property="docName"/></td>
  <td headers="Description"><bean:write name="doc" property="docDesc"/></td>
  <td headers="Filename"> 
  <%
    // strip off the path name and just display the file name
    String str = (String)PropertyUtils.getSimpleProperty(doc, "filePath");
    int idx = str.lastIndexOf("/");
    if (idx == -1) {
  %>
  <%= str %>
  <% } else { %>
  <%= str.substring(idx+1, str.length()) %>
  <% }
     str = com.broadvision.cm.service.util.NameUtil.URLEncode(str, request.getCharacterEncoding());
  %> 
  </td>
 
  <td headers="Action">
    <a href="<html:rewrite page='<%="/download/" + str %>'/>" target="download">
  	  <img src="<%= request.getContextPath() + "/ca/images/action/icon_download.gif" %>" class="actionIcon" border="0" alt="<bean:message bundle="appCommonRes" key="dr.download"/>" title="<bean:message bundle="appCommonRes" key="dr.download"/>"></a>
  </td>

</tr>
</logic:iterate>
</table>
</form>
</div>
